﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Threading;
using System.Net;

namespace PowerManager.Framework.ModleBuilder
{
    [Serializable]
    [Model("BasicModel")]
    public abstract class BasicModelBase:MarshalByRefObject,IModel
    {
        public void BindingTo(IPAddress ipAddress) {
            ModelEngine.BuildModel(ipAddress, this);
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged(String property) {
            var handle = Interlocked.CompareExchange(ref PropertyChanged, null, null);
            if (handle != null) {
                handle(this, new PropertyChangedEventArgs(property));
            }
        }
    }
}
